import { RouteRecordRaw } from 'vue-router';
import { Layout, ParentLayout } from '@/router/constant';
import { WalletOutlined,DatabaseFilled } from '@vicons/antd';
import {UserCog,ChalkboardTeacher} from '@vicons/fa';
import {Organization24Filled} from '@vicons/fluent';
import { renderIcon, renderNew } from '@/utils';

const routeName = 'manager';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/manager',
    name: routeName,
    component: Layout,
    redirect: '/manager/userManager',
    meta: {
      title: '管理员',
      icon: renderIcon(DatabaseFilled),
      sort: 10,
      permissions:['manager']
    },
    children: [
        {
          path:'userManager',
          name: `${routeName}_userManage`,
          component: ParentLayout,
          meta:{
            title:'用户管理',
            icon: renderIcon(UserCog),
          },
          children:[
            {
              path: 'teacher',
              name: `${routeName}_userManage_teacher`,
              meta: {
                  title: '职工管理',
              },
              component: () => import('@/views/manager/userManage/teacher.vue'),
            },
            {
                path: 'student',
                name: `${routeName}_userManage_student`,
                meta: {
                    title: '学生管理',
                },
                component: () => import('@/views/manager/userManage/student.vue'),
            },
          ]
        },{
          path:'organizeManager',
          name: `${routeName}_organizeManage`,
          redirect:'/manager/organizeManager/academyMajor',
          component: ParentLayout,
          meta:{
            title:'组织管理',
            icon:renderIcon(Organization24Filled)
          },
          children:[
            {
              path:'academyMajor',
              name:`${routeName}_organizeManage_academyMajor`,
              meta:{
                title:'院系管理'
              },
              component:()=>import('@/views/manager/organizeManage/academyMajor.vue')
            },{
              path:'calse',
              name:`${routeName}_organizeManage_clase`,
              meta:{
                title:'班级管理'
              },
              component:()=>import('@/views/manager/organizeManage/clase.vue')
            }
          ]
        },{
          path:'courseManager',
          name: `${routeName}_courseManage`,
          component: ParentLayout,
          meta:{
            title:'课程管理',
            icon:renderIcon(ChalkboardTeacher)
          },
          children:[
            {
              path:'student',
              name:`${routeName}_courseManage_student`,
              meta:{
                title:'学生课程管理'
              },
              component:()=>import('@/views/manager/courseManage/student.vue')
            },{
              path:'teacher',
              name:`${routeName}_courseManage_teacher`,
              meta:{
                title:'教师课程管理'
              },
              component:()=>import('@/views/manager/courseManage/teacher.vue')
            }
          ]
        }
    ],
  },
];

export default routes;
